<template>
	<view>
		<view class="u-padding-top-20">
			<u-button type="primary" shape="circle" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">快速登录</u-button>
		</view>
	</view>
</template>

<script setup lang="ts">
import { useUserStore } from '@/stores/user';
import { Local } from '@/utils/storage';
const storesUserStore = useUserStore();
const getPhoneNumber = (e: any) => {
	if (e.detail) {
		console.log(JSON.stringify(e.detail));
		storesUserStore.quickLogin({ code: e.detail.code }).then((response) => {
			uni.$u.toast('登录成功');
			//获取用户信息
			storesUserStore.getInfo();
			uni.$hxRouter.push({ type: 'reLaunch', url: Local.get('redirectUrl') ? Local.get('redirectUrl') : '/pages/home/index' });
			Local.remove('redirectUrl');
		});
	}
};
</script>

<style></style>
